package com.acwing.partition11;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class AC1021货币系统 {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] s = reader.readLine().split("\\s+");
        int n = Integer.parseInt(s[0]), m = Integer.parseInt(s[1]);
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(reader.readLine().split("\\s+")[0]);
        }
        writer.write(String.valueOf(dynamicProgramming(nums, m)));
        writer.flush();
    }

    private static long dynamicProgramming(int[] nums, int m) {
        long[] dp = new long[m + 1];
        dp[0] = 1;
        for (int i = 0; i < nums.length; i++) {
            for (int j = nums[i]; j <= m; j++) {
                dp[j] += dp[j - nums[i]];
            }
        }
        return dp[m];
    }
}
